package com.jintian.hnsj_metting;

import android.app.ProgressDialog;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.hjq.http.listener.OnHttpListener;

import okhttp3.Call;

/**
 * author : Android 轮子哥
 * github : https://github.com/getActivity/EasyHttp
 * time   : 2019/05/19
 * desc   : 基类封装
 */
public class BaseActivity extends AppCompatActivity implements OnHttpListener<Object> {

    /**
     * 加载对话框
     */
    private ProgressDialog mDialog;
    /**
     * 对话框数量
     */
    private int mDialogTotal;

    /**
     * 当前加载对话框是否在显示中
     */
    public boolean isShowDialog() {
        return mDialog != null && mDialog.isShowing();
    }

    /**
     * 显示加载对话框
     */
    public void showDialog() {

    }

    /**
     * 隐藏加载对话框
     */
    public void hideDialog() {

    }

    @Override
    public void onHttpStart(Call call) {
        showDialog();
    }

    @Override
    public void onHttpSuccess(Object result) {
    }

    @Override
    public void onHttpFail(Throwable throwable) {
//        Toast.makeText(this, throwable.getMessage(), Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onHttpEnd(Call call) {
        hideDialog();
    }
}